// eslint-disable-next-line strict
const Controller = require('egg').Controller;

class HelloController extends Controller {
  async index() {
    const res = await this.ctx.service.hello.getMessage();
    if (res) {
      this.ctx.body = {
        code: 20000,
        data: res,
      };
    } else {
      this.ctx.body = {
        code: 50000,
        data: '数据获取失败',
      };
    }
  }
}

module.exports = HelloController;
